import java.sql.{Connection, DriverManager}

object TestMySQLConnection {
  def main(args: Array[String]): Unit = {
    val url = "jdbc:mysql://localhost:3306/spark_db"
    val username = "root"
    val password = "123456"

    Class.forName("com.mysql.cj.jdbc.Driver")
    val connection = DriverManager.getConnection(url, username, password)

    println("Connected to MySQL database successfully!")
    connection.close()
  }
}